
package com.catsic.pub.specification;

import com.catsic.base.specification.BaseSpec;
import com.catsic.base.specification.QueryWraper;
import com.catsic.pub.condition.XzqhCondition;
import com.catsic.pub.entity.Xzqh;
/**
 * ClassName: XzqhSpec
 * Description: XzqhSpec
 * date: 2013年4月28日 下午2:30:29
 * author: yangyd
 */
public class XzqhSpec extends BaseSpec<Xzqh> {

	public XzqhSpec(XzqhCondition condition){
		super(condition);
	}
	
	/**
	 * @see com.catsic.core.specification.BaseSpec#addCondition(com.catsic.core.specification.QueryWraper)
	 */
	@Override
	protected void addCondition(QueryWraper<Xzqh> queryWraper) {
		XzqhCondition condition = (XzqhCondition)getCondition();
		addLikeCondition(queryWraper, "name");
		addEqualCondition(queryWraper, "jb");
		addEqualCondition(queryWraper, queryWraper.getRoot().get("parent").get("id"),condition.getPid() );
		/**
		 * 自定义排序
		 */
		queryWraper.addOrder(queryWraper.getCb().asc(queryWraper.getRoot().get("id")));
	}
}
